#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
using namespace std;
void func()
{
	int n = 1;
	while (1)
	{
		void* p1 = new char[1024 * 1024 ];
		cout << p1 << "->" << n << endl;
		n++;
	}
}
int main()
{
	//throw try/catch
	try
	{
		//void* p1 = new char[1024 * 1024 * 1024];
		//cout << p1 << endl;
		//void* p2 = new char[1024 * 1024 * 1024];
		//cout << p2 << endl;
		//void* p3 = new char[1024 * 1024 * 1024];
		//cout << p3 << endl;
		//void* p4 = new char[1024 * 1024 * 1024];
		func();
	}
	catch (const exception& e)
	{
		cout << e.what() << endl;
	}
	return 0;
}